<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SHOP 管理中心 - 属性管理 </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="web/back/styles/general.css" rel="stylesheet" type="text/css" />
<link href="web/back/styles/main.css" rel="stylesheet" type="text/css" />
</head>
<body>

<h1>
<span class="action-span"><a href="index.php?p=back&c=attribute&a=add">添加属性</a></span>
<span class="action-span1"><a href="index.php?act=main">SHOP 管理中心</a> </span><span id="search_id" class="action-span1"> - 商品属性 </span>
<div style="clear:both"></div>
</h1>

<div class="form-div">
  <form action="" name="searchForm">
    <img src="web/back/images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH">
    按商品类型显示：<select name="goods_type" onchange="searchAttr(this.value)">
                        <option value="0">所有商品类型</option>
                        <?php foreach($types as $type) :?>
                        <option value="<?php echo $type['type_id']?>"
                         <?php echo ($type_id == $type['type_id']) ? "selected" : ""?>
                        ><?php echo $type['type_name']?></option>
                        <?php endforeach; ?>
                   </select>
  </form>
</div>

<form method="post" action="index.php?p=back&c=attribute&a=deleteAll" name="listForm">
<div class="list-div" id="listDiv">

  <table cellpadding="3" cellspacing="1">
    <tbody>
		<tr>
			<th><input onclick="listTable.selectAll(this, &quot;checkboxes[]&quot;)" type="checkbox">编号 </th>
			<th>属性名称</th>
			<th>商品类型</th>
			<th>属性值的录入方式</th>
			<th>可选值列表</th>
			<th>排序</a></th>
			<th>操作</th>
		</tr>
        <?php $index = 1; foreach($attrs as $attr) : ?>
        <tr>
			<td nowrap="true" valign="top"><span><input value="1" name="checkboxes[]" type="checkbox"/><?php echo $index++; ?></span></td>
			<td class="first-cell" nowrap="true" valign="top"><span onclick="listTable.edit(this, 'edit_attr_name', 1)"><?php echo $attr['attr_name']?></span></td>
			<td nowrap="true" valign="top"><span><?php echo $attr['type_name']?></span></td>
			<td nowrap="true" valign="top"><span>
              <?php
                switch($attr['attr_input_type']) {
                    case 0:
                    echo '手工录入';
                    break;
                    case 1:
                    echo '从下拉列表选择';
                    break;
                    case 2:
                    echo '多行文本框';
                    break;
                 }
              ?>
            </span></td>
			<td valign="top"><span></span></td>
			<td align="right" nowrap="true" valign="top"><span onclick="listTable.edit(this, 'edit_sort_order', 1)">0</span></td>
			<td align="center" nowrap="true" valign="top">
				<a href="index.php?p=back&c=attribute&a=edit&<?php echo $attr['attr_id']?>" title="编辑"><img src="web/back/images/icon_edit.gif" border="0" height="16" width="16"></a>
				<a href="index.php?p=back&c=attribute&a=edit&<?php echo $attr['attr_id']?>" onclick="removeRow(1)" title="移除"><img src="web/back/images/icon_drop.gif" border="0" height="16" width="16"></a>
			</td>
		</tr>
        <?php endforeach;?>
      </tbody>
  </table>

  <table cellpadding="4" cellspacing="0">
    <tbody>
      <tr>
        <td style="background-color: rgb(255, 255, 255);"><input type="submit" id="btnSubmit" value="删除" class="button" disabled="true"></td>
        <td align="right" style="background-color: rgb(255, 255, 255);">
          <div id="turn-page">
              <?php echo $pageinfo;?>
          </div>
        </td>
      </tr>
    </tbody>
  </table>
</div>

</form>

<div id="footer">
</div>
<script type="text/javascript">
    function searchAttr(type_id) {
        window.location.href  = "index.php?p=back&c=attribute&a=index&type_id="+type_id;
    }
</script>
</body>
</html>